package com.controller;

import com.pojo.HandSet;
import com.service.HandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping(value = "/hand")
public class HandController {
    @Autowired
    private HandService handService;

    @RequestMapping(value = "/list")
    public String handList(Model model){
        List<HandSet> list = handService.list();
        model.addAttribute("list",list);
        return "index";
    }

    @RequestMapping(value = "/findId")
    public String findId(Model model,int hsId){
        HandSet handSet = handService.findId(hsId);
        model.addAttribute("handSet",handSet);
        return "findId";
    }

    @RequestMapping(value = "/delete")
    public String delete(int hsId){
        int result = handService.delete(hsId);
        return "index";
    }
}
